﻿<shared:UserControlBase x:Class="Bymed.SpineScan.WPF.CustomizedUserControl.BuildInSingleTestResultHistoryDataReportContentUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:shared="clr-namespace:Bymed.SpineScan.WPF.Shared"
             xmlns:userControl="clr-namespace:Bymed.SpineScan.WPF.CustomizedUserControl"
             mc:Ignorable="d" 
             d:DesignHeight="1100" d:DesignWidth="793">
    <Grid Height="1100" Margin="10,12,0,0">
        <Grid.RowDefinitions>
            <!-- Report Header -->
            <RowDefinition Height="Auto" />
            <!-- Selected Test Item Name -->
            <RowDefinition Height="Auto" />
            <!-- Report Result Indicator -->
            <RowDefinition Height="Auto" />
            <!-- Test Result List -->
            <RowDefinition Height="Auto" />
            <!-- Footer -->
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <userControl:TestResultReportHeaderUserControl Margin="0,10,0,0" DataContext="{Binding}" />
        <TextBlock Grid.Row="1" HorizontalAlignment="Center" Margin="0,20,0,10" FontSize="26" Foreground="Black"
                   Text="{Binding SelectedTestItem.TestItemTitle}" Style="{StaticResource TestReportTitleTextBlock}" />
        <StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Center" Margin="16,0,0,3">
            <TextBlock Margin="0,0,10,0" VerticalAlignment="Center" Text="检测结果" Style="{StaticResource TestReportTextBlock}" />
            <Border Margin="0,0,5,0" Background="{StaticResource TestReportNormalRangeBackgroundBrush}" Style="{StaticResource TestReportResultIndicatorBorder}"  />
            <TextBlock Margin="0,0,20,0" VerticalAlignment="Center" Text="异常" Foreground="Black" Style="{StaticResource TestReportTextBlock}" />
            <Border Margin="0,0,5,0" Background="{StaticResource TestReportUnusualRangeBackgroundBrush}" Style="{StaticResource TestReportResultIndicatorBorder}" />
            <TextBlock Margin="0,0,20,0" VerticalAlignment="Center" Text="正常" Foreground="Black" Style="{StaticResource TestReportTextBlock}" />
        </StackPanel>
        <ListBox Grid.Row="3" Margin="4,10,10,0" BorderThickness="0" Height="760" ItemsSource="{Binding HistoryAnalysisChartSource}" VerticalAlignment="Top">
            <ListBox.Resources>
                <SolidColorBrush Color="Black" x:Key="{x:Static SystemColors.HighlightTextBrushKey}" />
                <SolidColorBrush Color="Transparent" x:Key="{x:Static SystemColors.HighlightBrushKey}" />
                <SolidColorBrush Color="Transparent" x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" />
            </ListBox.Resources>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <userControl:TestResultRegularChartUserControl Margin="0,0,0,8" 
                                                                   DisplayTestDateInstead="True" DataContext="{Binding}" Width="750">
                        <userControl:TestResultRegularChartUserControl.Style>
                            <Style TargetType="{x:Type userControl:TestResultRegularChartUserControl}">
                                <Setter Property="DisplayLineTrend" Value="False" />
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding TestItemName}" Value="ScoliosisATI">
                                        <Setter Property="DisplayLineTrend" Value="True" />
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </userControl:TestResultRegularChartUserControl.Style>
                    </userControl:TestResultRegularChartUserControl>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Grid Grid.Row="4" TextBlock.FontSize="13" Width="750" Margin="10,5,10,4" VerticalAlignment="Bottom">
            <Grid.RowDefinitions>
                <RowDefinition Height="35" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBlock>
                <TextBlock.Style>
                    <Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource TestReportTextBlock}">
                        <Setter Property="Text" Value="{Binding HistoryAnalysisChartSource[0].TestDateDisplay, StringFormat={}最后测试日期：{0}}" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding HistoryAnalysisChartSource.Count}" Value="0">
                                <Setter Property="Text" Value="无历史测试日期" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </TextBlock.Style>
            </TextBlock>
            <TextBlock Text="操作员签字：" Margin="0,0,120,0" HorizontalAlignment="Right" TextWrapping="Wrap" Style="{StaticResource TestReportTextBlock}" />
            <TextBlock Grid.Row="1" Text="本测量结果仅供临床医生参考，不作为诊断报告。" HorizontalAlignment="Right" Style="{StaticResource TestReportTextBlock}" />
        </Grid>
    </Grid>
</shared:UserControlBase>
